<?php

use app\admin\middleware\Auth;
use think\facade\Route;

/* 登录 */

Route::post('account/login', 'Login/account');  // 账号密码登录
Route::get('dingtalk/login', 'Dingtalk/login');  // 钉钉登录
Route::get('dingtalk/callback', 'Dingtalk/callback');  // 钉钉回调
Route::get('dingtalk/department/import', 'Dingtalk/import');  // 部门导入
Route::get('dingtalk/test', 'Dingtalk/test');  // 测试

/* 测试 */
Route::group('test', function () {

    Route::get('sendMessage', 'sendMessage');
    Route::get('sendDelayedMessage', 'sendDelayedMessage');
    Route::get('receiveMessage', 'receiveMessage');
    Route::get('receiveMessage', 'receiveMessage');
    Route::delete('', 'delete');
    Route::get('', 'Test');
})->prefix('Test/')->middleware('checkParams');


Route::group(function () {
    //商品管理

    Route::group('index', function () {
        Route::get('/order_ranking', 'OrderRanking');
        Route::get('/order_statistics', 'OrderStatistics');
        Route::get('/to_do', 'ToDo');
        Route::get('/initiated', 'Initiated');
        Route::get('/initiated_processed_result/:id', 'InitiatedProcessedResult');
    })->prefix('Index/')->middleware('checkParams');

    /* 员工管理 */
    Route::group('operator', function () {
        Route::get('', 'index');
        Route::post('', 'create');
        Route::put('', 'update');
        Route::delete('', 'delete');

        Route::get('/select$', 'getSelect');
        Route::get('/fieldEnum$', 'getFieldEnum');
        Route::get('/detail$', 'detail');
        Route::get('/roles$', 'roles');
    })->prefix('Operator/')->middleware('checkParams');

    /* 角色管理 */
    Route::group('role', function () {

        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get('/treeSelectOption', 'getTreeSelectOption');
        Route::get('list', 'list');
        Route::get('/detail', 'detail');
        Route::get(':id', 'show');
        Route::get('', 'index');
        Route::post('', 'create');
        Route::put('', 'update');
        Route::put('status', 'status');
        Route::delete('', 'delete');
    })->prefix('Role/')->middleware('checkParams');

    Route::get('role/menu', 'Role/menu');   // 动态路由菜单

    Route::post('role/setauth', 'Role/setAuth'); // 设置选项
    /* 权限表 */
    Route::post('auth/list', 'Auth/list');     // 权限列表
    Route::post('auth/detail', 'Auth/detail');   // 权限详情
    Route::post('auth/save', 'Auth/save');        // 添加/编辑权限
    Route::post('auth/remove', 'Auth/remove');   // 删除权限 (软删除)
    Route::post('auth/del', 'Auth/del');         //删除权限  (物理删除)

    //库存管理
    Route::get('inventory/:id$', 'Inventory/getInfo')->pattern(['id' => '\d+']); //必须放到获取list信息前面
    Route::get('inventory$', 'Inventory/getList');
    Route::get('inventory/merge', 'Inventory/merge');
    Route::delete('inventory$', 'Inventory/delete');
    Route::post('inventory/savePrice$', 'Inventory/savePrice');
    Route::post('inventory/fixSavePrice$', 'Inventory/fixSavePrice');
    Route::post('inventory/submitCheckApi', 'Inventory/submitCheckApi');
    Route::get('inventory/detail/:id$', 'Inventory/detail');
    Route::get('inventory/transDetail/:id$', 'Inventory/transDetail');
    Route::get('inventory/transEnum/:id$', 'Inventory/transEnum');
    Route::post('inventory/transSave$', 'Inventory/transSave');
    Route::get('inventory/fieldEnum', 'Inventory/getFieldEnum');
    Route::post('inventory/sale', 'Inventory/sale');
    Route::post('inventory/allowZero', 'Inventory/allowZero');
    Route::post('inventory/getOrderByInventory', 'Inventory/getOrderByInventory');
    Route::get('inventory/resource', 'Inventory/resource');
    Route::post('inventory/importPrice', 'Inventory/importPrice');
    Route::post('inventory/exportPrice', 'Inventory/exportPrice');
    Route::post('inventory/transSaveByOrder', 'Inventory/transSaveByOrder');
    Route::post('inventory/transSaveByWholesal', 'Inventory/transSaveByWholesal');
    Route::post('inventory/Baskets', 'Inventory/baskets');
    Route::get('inventory/transfer/detail$', 'Inventory/transferDetail');
    Route::post('inventory/transfer/storage', 'Inventory/storage'); //调拨单入库
    Route::post('inventory/transfer/delay', 'Inventory/delay'); //调拨单 延期入库
    Route::post('inventory/transfer', 'Inventory/transfer');
    Route::post('inventory/cancelTransfer', 'Inventory/cancelTransfer');
    Route::get('inventory/transfer', 'Inventory/transferList');
    Route::put('inventory/transfer', 'Inventory/transferUpdate');



    /* 产品管理 */
    Route::get('product/fieldEnum', 'Product/getFieldEnum');
    Route::get('product/:id', 'Product/getInfo')->pattern(['id' => '\d+']); //必须放到获取list信息前面
    Route::get('product$', 'Product/getList');
    Route::delete('product', 'Product/delete');
    Route::post('product/exportPrice$', 'Product/exportPrice');
    Route::post('product', 'Product/save');
    Route::put('product', 'Product/update');
    Route::get('product/inventory', 'Product/getInventoryList');
    Route::get('product/discount', 'Product/discount');
    Route::get('product/resource$', 'Product/resource');
    Route::get('product/hasPowerline', 'Product/hasPowerline');


    /* 分类管理 */
    Route::get('category/:id', 'Category/getInfo')->pattern(['id' => '\d+']); //必须放到获取list信息前面
    Route::get('category$', 'Category/getList');
    Route::delete('category', 'Category/delete');
    Route::post('category', 'Category/save');
    Route::put('category', 'Category/save');
    Route::get('category/select$', 'Category/getSelect');
    Route::get('category/selectTree$', 'Category/getSelectTree');

    /* 品牌管理 */
    Route::get('brand/:id', 'Brand/getInfo')->pattern(['id' => '\d+']); //必须放到获取list信息前面
    Route::get('brand$', 'Brand/getList');
    Route::delete('brand', 'Brand/delete');
    Route::post('brand', 'Brand/save');
    Route::put('brand', 'Brand/save');
    Route::get('brand/select$', 'Brand/getSelect');

    /* 配件管理 */
    Route::get('attachment/:id', 'Attachment/getInfo')->pattern(['id' => '\d+']); //必须放到获取list信息前面
    Route::get('attachment', 'Attachment/getList');
    Route::delete('attachment', 'Attachment/delete');
    Route::post('attachment', 'Attachment/save');
    Route::put('attachment', 'Attachment/update');

    /* 币种管理 */
    Route::get('currency/:id$', 'Currency/getInfo')->pattern(['id' => '\d+']);
    Route::get('currency/resource$', 'Currency/resource');
    Route::get('currency$', 'Currency/getList');
    Route::delete('currency', 'Currency/delete');
    Route::post('currency', 'Currency/save');
    Route::put('currency', 'Currency/save');
    Route::get('currency/select$', 'Currency/getSelect');

    /* 采购单管理 */
    Route::get('purchase/:id', 'Purchase/getInfo')->pattern(['id' => '\d+']);
    Route::get('purchase$', 'Purchase/getList');
    Route::delete('purchase$', 'Purchase/delete');
    Route::post('purchase$', 'Purchase/save');
    Route::put('purchase$', 'Purchase/save');
    Route::get('purchase/select$', 'Purchase/getSelect');
    Route::get('purchase/fieldEnum', 'Purchase/getFieldEnum');
    Route::post('purchase/examine', 'Purchase/examine');
    Route::post('purchase/confirm', 'Purchase/confirm');
    Route::post('purchase/entry', 'Purchase/entry');
    Route::post('purchase/batchEntry', 'Purchase/batchEntry');
    Route::post('purchase/redInkReversal', 'Purchase/redInkReversal');

    Route::get('purchase/salesOrderNo', 'Purchase/salesOrderNo');
    Route::get('purchase/orderProduct', 'Purchase/getOrderProduct');

    /* 采购物流费用 */
    Route::group('purchaseLogistics', function () {
        Route::get('', 'index');
        Route::get(':id', 'read');
        Route::post('', 'save');
        Route::put(':id', 'update');
        Route::delete(':id', 'delete');
    })->prefix('PurchaseLogistics/')->middleware('checkParams');

    /* 付款单管理 */
    Route::get('payment/:id$', 'Payment/getInfo')->pattern(['id' => '\d+']); //必须放到获取list信息前面
    Route::get('payment$', 'Payment/getList');
    Route::post('payment$', 'Payment/save');
    Route::delete('payment$', 'Payment/delete');
    Route::put('payment$', 'Payment/save');
    Route::get('payment/select$', 'Payment/getSelect');
    Route::get('payment/fieldEnum$', 'Payment/getFieldEnum');
    Route::post('payment/examine$', 'Payment/examine');
    Route::post('payment/proof$', 'Payment/proof');

    /* 渠道商管理  */
    Route::group('supplier', function () {

        /* 机型管理 */
        Route::group('modelinfo', function () {
            Route::get('/:id$', 'detail');
            Route::get('', 'getList');
            Route::post('', 'save');
            Route::put('/$', 'update');
        })->prefix('ModelInfo/');

        /* 供应商/零售商 */
        Route::group('seller', function () {
            Route::get('/resource$', 'resource');
            Route::get('/:id$', 'detail');
            Route::get('', 'getList');
            Route::post('', 'save');
            Route::put('/$', 'update');
            Route::delete('/$', 'delete');
        })->prefix('Seller/');

        /* 供应商/零售商商品管理 */
        Route::group('product', function () {

            Route::get('/resource$', 'resource');
            Route::get('/:id$', 'detail')->pattern(['id' => '\d+']);
            Route::get('/$', 'getList');
            Route::post('', 'save');
            Route::put('/status', 'status');
            Route::put('/$', 'update');
            Route::delete('/$', 'delete');

            /* 商品价格 */
            Route::group('price', function () {
                Route::get('/resource$', 'resource');
                Route::get('/$', 'getList');
                Route::get('/trend$', 'getTrend');
                Route::get('/trendList$', 'getTrendList');
            })->prefix('SellerProductPrice/');
        })->prefix('SellerProduct/');
    });



    /* 供应商管理 */
    Route::get('supplier/:id', 'Supplier/getInfo')->pattern(['id' => '\d+']); //必须放到获取list信息前面
    Route::get('supplier$', 'Supplier/getList');
    Route::delete('supplier', 'Supplier/delete');
    Route::post('supplier', 'Supplier/save');
    Route::put('supplier', 'Supplier/save');
    Route::get('supplier/select$', 'Supplier/getSelect');

    /* 供应商联系人 */
    Route::get('supplierContact/:id', 'SupplierContact/getInfo')->pattern(['id' => '\d+']); //必须放到获取list信息前面
    Route::get('supplierContact$', 'SupplierContact/getList');
    Route::delete('supplierContact', 'SupplierContact/delete');
    Route::post('supplierContact', 'SupplierContact/save');
    Route::put('supplierContact', 'SupplierContact/save');
    Route::get('supplierContact/select$', 'SupplierContact/getSelect');
    Route::get('supplierContact/fieldEnum$', 'SupplierContact/getFieldEnum');



    /* 仓库管理 */
    Route::get('warehouse/:id', 'Warehouse/getInfo')->pattern(['id' => '\d+']); //必须放到获取list信息前面
    Route::get('warehouse$', 'Warehouse/getList');
    Route::delete('warehouse$', 'Warehouse/delete');
    Route::post('warehouse$', 'Warehouse/save');
    Route::put('warehouse$', 'Warehouse/save');
    Route::get('warehouse/select$', 'Warehouse/getSelect');
    Route::get('warehouse/secondWarehouse$', 'Warehouse/secondWarehouse');
    Route::get('warehouse/firstWarehouse$', 'Warehouse/firstWarehouse');
    Route::get('warehouse/fieldEnum', 'Warehouse/getFieldEnum');
    Route::get('warehouse/selectEnum', 'Warehouse/getSelectEnum');
    Route::get('warehouse/searchCity', 'Warehouse/getSearchCity');
    Route::get('warehouse/getCurrencySelect', 'Warehouse/getCurrencySelect');


    Route::group('inventory_count', function () {
        Route::get('', 'getInventoryCountList');
        Route::get('/shipped_order', 'getShippedOrderList');
        Route::get('/lock_order', 'getLockOrderList');
        Route::get('/total_count', 'getInventoryTotalCount');
    })->prefix('InventoryCount/');

    /* 订单管理 */
    //    Route::get('order/:id', 'Order/getInfo')->pattern(['id' => '\d+']); //必须放到获取list信息前面
    //    Route::get('order$', 'Order/getList');
    //    Route::delete('order', 'Order/delete');
    //    Route::post('order', 'Order/save');
    //    Route::put('order', 'Order/save');
    //    Route::get('order/select$', 'Order/getSelect');
    //    Route::get('order/fieldEnum', 'Order/getFieldEnum');

    Route::group('order', function () {
        Route::get('/selectWarehouseProducts', 'selectWarehouseProducts');
        Route::get('/contractPreview', 'contractPreview'); // 合同预览
        Route::get('/approvalRecords', 'getApprovalRecords'); // 审批记录
        Route::get('/operateRecords', 'getOperationRecords'); // 操作记录
        Route::get('/associatedPurchaseOrders', 'getAsociatedPurchaseOrders'); //关联采购订单
        Route::get('/inventory_trans_save_info', 'getInventoryTransSaveInfo'); //库存转换信息


        Route::get('/:id', 'getInfo')->pattern(['id' => '\d+']); //必须放到获取list信息前面
        Route::get('copy/:id', 'copy')->pattern(['id' => '\d+']); //必须放到获取list信息前面
        Route::get('/review/:id', 'getReviewInfo');
        Route::get('', 'getList');
        Route::delete('', 'delete');
        Route::delete('/delete/:ids', 'del');
        Route::post('', 'save');
        Route::post('/delivery', 'delivery');
        Route::post('/cancelDelivery', 'cancelDelivery');
        Route::post('/receipt', 'receipt');
        Route::put('/examine/:id', 'examine');
        Route::put('/:id$', 'update');
        Route::put('/cancelUpdate/:id$', 'cancelUpdate');
        Route::get('/resource', 'getFieldEnum');
        Route::get('/transEnum', 'transEnum');
        Route::post('/transSave', 'transSave');
        Route::post('/getInventory', 'getInventory');
        Route::put('/confirm/:id', 'confirm');
        Route::put('/remark/:id', 'remark');
        Route::put('/cancel/:id', 'cancel');
        Route::post('/lockInventory', 'lockInventory');
        Route::put('/check_exception_order_item/:id', 'checkExceptionOrderItem');
        Route::post('/no_delivery', 'noDelivery');
        Route::get('/getInventoryByAbbr/:id', 'getInventoryByAbbr');
        Route::post('/changeWarehouse', 'changeWarehouse');
    })->prefix('Order/');

    /* 部分发货申请 */
    Route::group('orderPartDeliveryApply', function () {
        Route::get('', 'index');                // 获取列表
        Route::post('', 'create');              // 创建申请
        Route::post('/cancel', 'cancel');              // 申请撤销
        Route::put('', 'approve');  // 审核申请
    })->prefix('orderPartDeliveryApply/');

    /* 经销商订单 */
    Route::group('wholesalOrder', function () {
        Route::get('/:id', 'getInfo')->pattern(['id' => '\d+']); //必须放到获取list信息前面
        Route::get('copy/:id', 'copy')->pattern(['id' => '\d+']); //必须放到获取list信息前面
        Route::put('/cancel/:id', 'cancel');
        Route::get('', 'getList');
        Route::delete('', 'delete');
        Route::post('', 'save');
        Route::post('/deliver', 'deliver');
        Route::put('/examine/:id', 'examine');
        Route::put('/:id', 'update');
        Route::get('/select$', 'getSelect');
        Route::get('/resource', 'getFieldEnum');
    })->prefix('WholesalOrder/');

    /* 经销商资产管理 */
    Route::group('wholesalAssets', function () {
        Route::get('/:id', 'getInfo')->pattern(['id' => '\d+']); //必须放到获取list信息前面
        Route::get('', 'index');
        Route::get('/resource', 'resource');
    })->prefix('WholesalAssets/');

    Route::group('orderPayment', function () {
        Route::get('/resource$', 'resource');
        Route::get('/order_related_payment_list/:order_id', 'orderRelatedPaymentList');
        Route::put('/voucher$', 'voucher');
        Route::put('/cancellVoucher$', 'cancellVoucher');
        Route::post('/export$', 'export'); // 导出Excel
        Route::get('/', 'index');
        Route::put('/:id', 'examine');
    })->prefix('OrderPayment/');


    /* 新闻管理 */
    Route::group('cryptoNews', function () {
        Route::get('/:id', 'getInfo')->pattern(['id' => '\d+']);
        Route::get('', 'getList');
        Route::delete('', 'delete');
        Route::post('', 'save');
        Route::put('', 'save');
        Route::get('/select$', 'getSelect');
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::post('/status', 'status');
        Route::post('/publish', 'publish');
        Route::get('/machineList', 'machineList');
        Route::get('/searchNews/:id', 'searchNews');
    })->prefix('CryptoNews/');

    /* expandCustomer */
    Route::group('expandCustomer', function () {
        Route::get('/:id', 'read')->pattern(['id' => '\d+']);
        Route::get('', 'index');
    })->prefix('ExpandCustomer/');

    /* systemSMChannel */
    Route::group('systemSMChannel', function () {
        Route::get('', 'index');
        Route::put('/status', 'status');
        Route::put('/:id', 'update');
        Route::post('', 'save');
        Route::delete('', 'delete');
    })->prefix('SystemSMChannel/');

    /* systemLanguage */
    Route::group('systemLanguage', function () {
        Route::get('', 'index');
        Route::put('/status', 'status');
        Route::put('/:id', 'update');
        Route::post('', 'save');
        Route::delete('', 'delete');
    })->prefix('SystemLanguage/');

    Route::group('marketSocialMediaAccount', function () {
        Route::get('/resource', 'resource');
        Route::get('', 'index');
        Route::get('/:id', 'read');
        Route::put('/status', 'status');
        Route::put('/:id', 'update');
        Route::post('', 'save');
        Route::delete('', 'delete');
    })->prefix('MarketSocialMediaAccount/');

    Route::group('marketSocialMediaAccountGroup', function () {
        Route::get('/resource', 'resource');
        Route::get('', 'index');
        Route::get('/:id', 'read');
        Route::put('/status', 'status');
        Route::put('/:id', 'update');
        Route::post('', 'save');
        Route::delete('', 'delete');
    })->prefix('MarketSocialMediaAccountGroup/');

    /* 社媒文案 */
    Route::group('marketSMCopywriting', function () {
        Route::put('/publish', 'publish');
        Route::get('/regenerate/:id', 'regenerate');
        Route::put('', 'editContent');
    })->prefix('MarketSMCopywriting/');

    /* 社媒文案任务 */
    Route::group('marketSmCopywritingTasks', function () {
        Route::post('/batchGeneration', 'batchGeneration');
        Route::get('/:id', 'read');
    })->prefix('MarketSmCopywritingTasks/');

    /* 社媒文案任务 */
    Route::group('template', function () {
        Route::post('', 'download');
    })->prefix('Template/');

    /* 矿机视频管理 */
    Route::group('miner/video', function () {
        Route::get('/resource', 'resource');
        Route::get('/$', 'getList');
        Route::get('/:id$', 'detail');
        Route::post('', 'save');
        Route::put('/status', 'status');
        Route::put('', 'update');
        Route::delete('', 'delete');
    })->prefix('MinerVideo/');


    /* 地址管理 */
    Route::get('address$', 'Address/getList');

    Route::group('address', function () {
        Route::get('/:id', 'detail')->pattern(['id' => '\d+']);
        Route::get('', 'getList');
        Route::delete('', 'del');
        Route::post('', 'save');
        Route::put('', 'save');
    })->prefix('Address/');

    Route::group('region', function () {
        Route::get('/country', 'countryList');
        Route::get('/city', 'cityList');
        Route::get('/area', 'area');
    })->prefix('Region/');

    Route::group('customer', function () {
        /* 客户跟进 */
        Route::group('followRecords', function () {
            Route::get('/resource', 'resource');
            Route::get('/order', 'getOrderList');
            Route::get('/$', 'getList');
            Route::get('/:id$', 'detail');
            Route::post('', 'save');
            Route::put('/status', 'status');
            Route::put('', 'update');
            Route::delete('', 'delete');
        })->prefix('FollowRecords/')->middleware('checkParams');

        Route::get('/select$', 'getSelect');
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get('/discountList$', 'discountList');
        Route::get('/operationLog', 'getOperationLog'); // 操作日志
        Route::get('/approvalRecords', 'getApprovalRecords'); // 审批记录
        Route::put('/public/allocation', 'allocationPublicCustomer');
        Route::get('/:id$', 'show');
        Route::get('', 'index');
        Route::post('', 'create');
        Route::put('/public/fishing', 'fishingPublicCustomer');
        Route::put('/returnPublic', 'returnPublic');
        Route::put('/role', 'role');
        Route::put('', 'update');
        Route::delete('', 'delete');
    })->prefix('Customer/')->middleware('checkParams');


    /* 退款单管理 */
    Route::group('returnorder', function () {
        Route::get('/resource', 'resource');
        Route::get('/order', 'getOrderList');
        Route::get('/$', 'getList');
        Route::get('/return_order', 'getReturnOrderList');
        Route::get('/operateRecords', 'getOperationRecords'); // 操作记录
        Route::post('/return_order/stock', 'stock');
        Route::get('/refund_order', 'getRefundOrderList');
        Route::get('/:id$', 'detail');
        Route::post('/$', 'save');
        Route::put('/status', 'status');
        Route::put('/cancel/:id', 'cancel');
        Route::put('/review/:id', 'review');
        Route::put('/:id', 'update');
        Route::post('/payment$', 'returnorderPayment');
    })->prefix('Returnorder/')->middleware('checkParams');


    Route::group('customerContact', function () {
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get(':id', 'show');
        Route::get('', 'index');
        Route::post('', 'create');
        Route::put('', 'update');
        Route::delete('', 'delete');
    })->prefix('CustomerContact/')->middleware('checkParams');

    /*
     员工信息
     */
    Route::group('staffInfo', function () {
        Route::get('', 'index');
        Route::delete('', 'delete');
        Route::get('/fieldEnum$', 'getFieldEnum');
        Route::get(':id', 'show');
        Route::post('', 'create');
        Route::put('', 'update');
    })->prefix('StaffInfo/')->middleware('checkParams');

    /*
        矿池
        */
    Route::group('minerPool', function () {
        Route::get('', 'index');
        Route::delete('', 'delete');
        Route::get('/fieldEnum$', 'getFieldEnum');
        Route::get(':id', 'show');
        Route::post('', 'create');
        Route::put('', 'update');
    })->prefix('MinerPool/')->middleware('checkParams');

    /*
        矿机手册
        */
    Route::group('manualBook', function () {
        Route::get('', 'index');
        Route::delete('', 'delete');
        Route::get('/fieldEnum$', 'getFieldEnum');
        Route::get(':id', 'show');
        Route::post('', 'create');
        Route::put('', 'update');
    })->prefix('ManualBook/')->middleware('checkParams');

    /*
        广告
        */
    Route::group('advertisement', function () {
        Route::get('', 'index');
        Route::delete('', 'delete');
        Route::get('/fieldEnum$', 'getFieldEnum');
        Route::get(':id', 'show');
        Route::post('', 'create');
        Route::put('', 'update');
    })->prefix('Advertisement/')->middleware('checkParams');
    /*
     文章管理
     */
    Route::group('article', function () {
        Route::get('', 'index');
        Route::delete('', 'delete');
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get(':id', 'show');
        Route::post('', 'create');
        Route::put('', 'update');
    })->prefix('Article/')->middleware('checkParams');

    /*
    *  推荐矿机
   */
    Route::group('recommendProduct', function () {
        Route::get('', 'index');
        Route::get('selected$', 'selected');
        Route::delete('', 'delete');
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get(':id', 'show');
        Route::post('', 'create');
        Route::put('', 'update');
    })->prefix('RecommendProduct/')->middleware('checkParams');

    /*
        翻译
   */
    Route::group('translate', function () {
        Route::get('', 'index');
        Route::put('', 'update');
    })->prefix('Translate/')->middleware('checkParams');
    /*
        折扣管理
        */
    Route::group('discount', function () {
        Route::get('/discountTotal:id', 'discountTotal');
        Route::get('', 'index');
        Route::delete('', 'delete');
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get(':id', 'show');
        Route::post('', 'create');
        Route::put('changeStatus', 'status');
        Route::put('', 'update');
    })->prefix('Discount/')->middleware('checkParams');
    /*
   站内信
   */
    Route::group('message', function () {
        Route::get('', 'index');
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get('/delete', 'delete');
        Route::post('/handle', 'handle');
    })->prefix('Message/')->middleware('checkParams');

    /*
        国家分类列表
  */
    Route::group('classification', function () {
        Route::get('', 'index');
        Route::get('/sellableList', 'sellableList');
        Route::get('/select$', 'getSelect');
        Route::delete('', 'delete');
        Route::post('distributCountry', 'distributCountry');
        Route::post('availableWarehouse', 'availableWarehouse');
        Route::get(':id', 'show');
        Route::post('', 'create');
        Route::put('', 'update');
    })->prefix('Classification/')->middleware('checkParams');

    /* 物流公司管理 */
    Route::group('logisticsCompany', function () {
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get('/select$', 'getSelect');
        Route::get(':id', 'show');
        Route::get('', 'index');
        Route::post('', 'create');
        Route::put('', 'update');
        Route::delete('', 'delete');
        Route::post('/status', 'batchUpdateStatus');  // 批量更新状态
    })->prefix('logisticsCompany/')->middleware('checkParams');

    /* 物流规则管理 */
    Route::group('LogisticsRules', function () {

        Route::get('/export', 'export');
        Route::post('/import', 'import');

        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get('/logisticsFee', 'getLogisticsFee');
        Route::post('/logisticsFee', 'getLogisticsFee');
        Route::post('/calculateFee', 'calculateFee');
        Route::get(':id', 'show');
        Route::get('', 'index');
        Route::post('', 'create');
        Route::post('/status', 'status');
        Route::put('', 'update');
        Route::delete('', 'delete');
        Route::post('active', 'getActiveList');
        // Route::post('getLogisticsFeeByWeb', 'getLogisticsFeeByWeb');
    })->prefix('LogisticsRules/')->middleware('checkParams');


    Route::group('department', function () {
        Route::get('/treeSelectOption', 'getTreeSelectOption');
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get(':id', 'show');
        Route::get('', 'index');
        Route::post('', 'create');
        Route::put('', 'update');
        Route::delete('', 'delete');
    })->prefix('Department/')->middleware('checkParams');


    Route::group('transactionCurrency', function () {
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get('/treeSelectOption', 'getTreeSelectOption');
        Route::get('/selectOption', 'getSelectOption');
        Route::get(':id', 'show');
        Route::get('', 'index');
        Route::post('/status', 'status');
        Route::post('', 'create');
        Route::put('', 'update');
        Route::delete('', 'delete');
    })->prefix('TransactionCurrency/')->middleware('checkParams');


    Route::group('regionCountry', function () {
        Route::get('/selectOption', 'selectOption');
        Route::get(':id', 'show');
        Route::get('', 'index');
        Route::post('', 'create');
        Route::put('', 'update');
        Route::delete('', 'delete');
    })->prefix('RegionCountry/')->middleware('checkParams');


    /* 采购物流费用 */
    Route::group('systemConfig', function () {
        Route::get('', 'index');
        Route::get(':id', 'read');
        Route::post('', 'save');
        Route::put(':id', 'update');
        Route::delete(':id', 'delete');
    })->prefix('systemConfig/')->middleware('checkParams');

    /* 系统错误日志 */
    Route::group('systemErrorLog', function () {
        Route::get('', 'index');
        Route::delete('', 'delete');
    })->prefix('systemErrorLog/')->middleware('checkParams');

    /* 菜单管理 */
    Route::group('menu', function () {
        Route::get('role/list', 'RoleMenu');
        Route::put('/status', 'status');
        Route::get('', 'index');
        Route::get('detail', 'detail');
        Route::post('', 'create');
        Route::put('', 'update');
        Route::delete('', 'delete');


        /* 权限管理 */
        Route::group('role', function () {
            Route::get('', 'index');
            Route::post('', 'create');
            Route::put('', 'update');
            Route::delete('', 'delete');
        })->prefix('MenuRole/')->middleware('checkParams');
    })->prefix('Menu/')->middleware('checkParams');


    Route::group('minescreenFirmwareVersion', function () {

        Route::get('', 'index');
        Route::get('/read/:fvid', 'read');
        Route::post('', 'save');
        Route::put('', 'update');
        Route::delete('', 'delete');
    })->prefix('MinescreenFirmwareVersion/')->middleware('checkParams');

    Route::group('customerInvoicebasicinfo', function () {
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get('/:id$', 'show');
        Route::get('', 'index');
        Route::post('', 'create');
        Route::put('', 'update');
        Route::delete('', 'delete');
    })->prefix('CustomerInvoicebasicinfo/')->middleware('checkParams');


    Route::group('invoice', function () {
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get('/:id$', 'read');
        Route::get('', 'index');
        Route::post('', 'create');
        Route::post('/check', 'check');
        Route::put('/uploadInvoice', 'uploadInvoice');
        Route::put('', 'update');
        Route::put('/cancel/:id$', 'cancel');
        Route::delete('', 'delete');
    })->prefix('invoice/')->middleware('checkParams');

    Route::group('filingcabinet', function () {
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get('/:id$', 'read');
        Route::get('', 'index');
        Route::post('', 'create');
        Route::put('', 'update');
        Route::delete('', 'delete');
    })->prefix('filingcabinet/')->middleware('checkParams');


    Route::group('productMerge', function () {
        Route::get('/select', 'select');
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get('/selected_sku_id', 'getSelectedSkuId');
        Route::get('/:id', 'read');
        Route::get('', 'index');
        Route::post('', 'create');
        Route::put('', 'update');
        Route::delete('', 'delete');
    })->prefix('productMerge/')->middleware('checkParams');

    Route::group('logisticsOrder', function () {
        Route::put('/:id', 'update');
    })->prefix('logisticsOrder/')->middleware('checkParams');


    Route::group('partner', function () {
        Route::get('/select', 'select');
        Route::get('/fieldEnum', 'getFieldEnum');
        Route::get('/:id', 'read');
        Route::get('', 'index');
        Route::post('', 'save');
        Route::put('', 'update');
        Route::delete('/:id', 'delete');
    })->prefix('partner/')->middleware('checkParams');


    Route::group('serialnumber', function () {
        Route::get('/fieldEnum', 'resource');
        Route::get('/scanlog', 'scanlog');
        Route::get('/:id', 'read');
        Route::get('', 'index');
        Route::post('', 'save');
        Route::post('/discard', 'discard');
        Route::post('/scanCode', 'scanCode');
        Route::post('/generate_sn_pictures', 'generateSnPictures');
        Route::put('', 'update');
        Route::delete('', 'delete');
    })->prefix('serialnumber/')->middleware('checkParams');


    Route::group('product_price', function () {
        Route::get('/fieldEnum', 'resource');
        Route::get('/:id', 'read');
        Route::get('', 'index');
        Route::put('', 'update');
        Route::put('/update_price', 'updatePriceAndDiscount');
    })->prefix('product_price/')->middleware('checkParams');

    Route::group('miner_firmwareversion', function () {
        Route::get('/fieldEnum', 'resource');
        Route::get('/:id', 'read');
        Route::get('', 'index');
        Route::post('', 'create');
        Route::put('', 'update');
        Route::delete('/:id', 'delete');
    })->prefix('miner_firmwareversion/')->middleware('checkParams');

    /* 退出系统 */
    Route::post('logout', 'Login/logout');      // 退出系统
})->middleware([Auth::class]);


Route::group('crontab', function () {
    Route::get('/generationSMCopywriting', 'generationSMCopywriting');
    Route::get('/syncCustomerId', 'syncCustomerId');
    Route::get('/getProfitForCache', 'getProfitForCache');
    Route::get('/generate_sn_pictures', 'generateSnPictures');
})->prefix('Crontab/');

Route::miss(function () {
    return json(['code' => 404, 'msg' => 'Route Not Found']);
});
